﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Xunit;
using MongoServices.Tests.Stubs;

namespace MongoServices.Tests.ConfigurationTests
{
	public class InitializerTests : TestBase
	{
		public InitializerTests()
		{
			Setup();
		}

		private void Setup()
		{
			MongoServicesConfig.Initialize();
		}

		public override void Dispose()
		{
			base.Dispose();

			InitializerStub.ModelSetupCallCount = 0;
			InitializerStub.RepositorySetupCallCount = 0;
			InitializerStub.ServiceSetupCallCount = 0;
		}
	}

	public class WhenMongoServicesConfigInitializeConfigIsCalled : InitializerTests
	{
		[Fact]
		public void ModelInitializerSetupWillBeCalled()
		{
			Assert.Equal(1, InitializerStub.ModelSetupCallCount);
		}
	
		[Fact]
		public void RepositoryInitializerSetupWillBeCalled()
		{
			Assert.Equal(1, InitializerStub.RepositorySetupCallCount);
		}

		[Fact]
		public void ServiceInitializerSetupWillBeCalled()
		{
			Assert.Equal(1, InitializerStub.ServiceSetupCallCount);
		}
	}
}
